package com.stiff.manage.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.stiff.common.bean.EasyUIResult;
import com.stiff.manage.mapper.ContentMapper;
import com.stiff.manage.pojo.Content;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ContentService extends BaseService<Content>{
    @Autowired
    private ContentMapper contentMapper;
    
    public EasyUIResult queryPageList(Long categoryId, Integer page, Integer rows) {
        PageHelper.startPage(page,rows);
        List<Content> list = this.contentMapper.queryList(categoryId);
        PageInfo<Content> contentPageInfo = new PageInfo<>(list);
        EasyUIResult easyUIResult = new EasyUIResult(contentPageInfo.getTotal(),contentPageInfo.getList());
        return easyUIResult;
    }
}
